/*
 * @Descripttion: 路由配置
 * @version: 1.0.0
 * @Author: shuaishuai.han
 * @Date: 2022-05-11 14:09:10
 */
import Vue from 'vue';
import Router from 'vue-router';
import { globalConfig } from '../../config';

Vue.use(Router);

/**
 * meta 字段含义
 * activeName title名字
 * isClosed 判断功能是否开通 true 已开放 false 暂未开通
 * keepAlive 组件是否缓存 true 缓存 false 不缓存
 * autority 功能模块是否需要用户登录
 */
const router = new Router({
  mode: 'history',
  base: globalConfig.router.base,
  routes: [
    {
      path: '/',
      name: 'home',
      meta: {
        activeName: ''
      },
      component: () => import('@/pages/home')
    }
  ]
});

// 防止路由跳转重复报错
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

export default router;
